package com.starview.platform.data;

import java.util.Collection;

/**
 * The extensible array allows the size of the array to be adjusted, either by adding elements or by
 * truncating it.
 * 
 * @author fgm
 * 
 */
public interface IExtensibleArray extends IArray
{
  /**
   * Add a new entry to the end of the array.
   * 
   * @param value
   *          the new value to add.
   * @throws EvaluationException
   *           if there is a problem with the addition.
   */
  IExtensibleArray addCell(IValue value) throws EvaluationException;

  /**
   * Add in a collection of entries
   * 
   * @param values
   * @return the updated array
   * @throws EvaluationException
   */
  IExtensibleArray addCells(Collection<IValue> values) throws EvaluationException;

  /**
   * Add an element to the front
   * 
   * @param el
   * @throws EvaluationException
   */
  IExtensibleArray consCell(IValue el) throws EvaluationException;

  /**
   * Remove a cell from the array
   * 
   * @param ix
   * @throws EvaluationException
   */
  IExtensibleArray removeCell(int ix) throws EvaluationException;
}
